<!-- 结构 -->
<script setup lang="ts">
import { ref } from "vue";
// 引入子组件
import ChildComp from "./components/ChildComp.vue";

const flag = ref(true)

</script>

<!-- JS逻辑 -->
<template>
    <div class="app-page">

        <div>我是父组件</div>
        <!-- 使用子组件 -->
        <ChildComp v-if="flag" />
        <button @click="flag = false">销毁</button>

    </div>
</template>

<!-- 样式 -->
<style lang="css" scoped></style>